<%@ include file="/en/jsp/static.jsp" %>
<%@ page import="linuxbox.status.logic.*" %>
<%@ taglib uri="/linuxbox/status.tld" prefix="status" %>

<%
  String  SortType = "LAST_NAME";
  String tmp = request.getParameter("SORT_TYPE");
  if (tmp != null && tmp.length() > 0)
    SortType = tmp;

  StatusManager sm = StatusManager.getInstance();
  boolean isCheckIn = sm.isCheckIn(curID);
  int CUR_STATUS = -1;
  try
  {
    StatusObject curStatus = sm.getStatus(curID);
    if (curStatus != null)
      CUR_STATUS = curStatus.getStatus();
  }
  catch (Exception e)
  {};


%>
<jsp:include page="/en/jsp/header.jsp" flush="true"/>

<SCRIPT LANGUAGE="Javascript">
function setStatus() {
    document.status.action = "<%=BoxStatic.servletDir%>StatusSetAction?ID=<%=curID%>";
    document.status.submit();
}
</SCRIPT>


<table width="100%" height=26 align=middle border=0 cellpadding=0 cellspacing=0 bgcolor="#f4f4f4" style="font-size:16px;color:#d05000">
<tr><td>
    &nbsp;<img src="<%=BoxStatic.imageDir%>itemball.jpg" width=14 height=15 border=0 align="absmiddle">
    <b><%=boxName%> - User Status</b>
</td></tr>
</table>
<%=CUR_STATUS%>
  <TABLE class="t1" WIDTH="98%" BORDER=0 CELLSPACING=1 CELLPADDING=0>
    <TR bgcolor=silver>
    <% if (isCheckIn) { %>
    <TD><A href="<%=BoxStatic.servletDir%>StatusCheckOutAction?ID=<%=curID%>">Check Out</A></TD>
      <% } else { %>
    <TD><A href="<%=BoxStatic.servletDir%>StatusCheckInAction?ID=<%=curID%>">Check In</A></TD>
    <% } %>
    <TD>
        <FORM METHOD="POST" NAME="status">
          My Status:
          <SELECT NAME="STATUS_ID">
        <status:StatusOptionList listType="list" selected="<%=CUR_STATUS%>" />
      </select>
       <A HREF="javascript: setStatus()">Set!</A>
     </form>
    </TD>
    </TR>
  </TABLE>

  <TABLE class="t1" WIDTH="98%" BORDER=0 CELLSPACING=1 CELLPADDING=0>
    <TR bgcolor=silver>
    <TH><A href="<%=BoxStatic.jspDir%>status/Status.jsp?SORT_TYPE=LAST_NAME">Last Name</A></TH>
    <TH>First Name</TH>
    <TH><A href="<%=BoxStatic.jspDir%>status/Status.jsp?SORT_TYPE=STATUS">Status</A></TH>
    <TH><A href="<%=BoxStatic.jspDir%>status/Status.jsp?SORT_TYPE=DEPT">Department</A></TH>
    <TH>CheckIn Time</TH>
    </TR>

    <status:StatusList listType="table" sortType="<%=SortType%>"/>

  </TABLE>
<jsp:include page="/en/jsp/footer.jsp" flush="true"/>
